﻿using System.Collections.Generic;
using System;
using WuDada.Trade.DataLoader.Domain;

namespace WuDada.Trade.DataLoader.Service
{
    public interface IDataLoadService
    {
        /// <summary>
        /// 新增股票歷史資料
        /// </summary>
        /// <param name="stockDataVO">被新增的股票歷史資料</param>
        /// <returns>新增後的股票歷史資料</returns>
        StockDataVO CreateStockData(StockDataVO stockDataVO);

        /// <summary>
        /// 更新股票歷史資料
        /// </summary>
        /// <param name="stockDataVO">被更新的股票歷史資料</param>
        /// <returns>更新後的股票歷史資料</returns>
        StockDataVO UpdateStockData(StockDataVO stockDataVO);

        /// <summary>
        /// 刪除股票歷史資料
        /// </summary>
        /// <param name="stockDataVO">被刪除的股票歷史資料</param>
        void DeleteStockData(StockDataVO stockDataVO);

        /// <summary>
        /// 取得股票歷史資料 By 識別碼
        /// </summary>
        /// <param name="stockDataId">識別碼</param>
        /// <returns>股票歷史資料</returns>
        StockDataVO GetStockDataById(int stockDataId);

        /// <summary>
        /// 取得股票歷史資料 By 股票代碼 And 資料日期/時間
        /// </summary>
        /// <param name="stockCode">股票代碼</param>
        /// <param name="dataTime">資料日期/時間</param>
        /// <returns>股票歷史資料</returns>
        StockDataVO GetStockData(string stockCode, DateTime dataTime);

        /// <summary>
        /// 取得股票歷史資料清單
        /// </summary>
        /// <param name="queryString">搜尋語法，用Where...order by ...</param>
        /// <param name="pageIndex">分頁索引</param>
        /// <param name="pageSize">分頁大小</param>
        /// <returns>股票歷史資料清單</returns>
        IList<StockDataVO> GetStockDataList(string queryString, int pageIndex, int pageSize);

        /// <summary>
        /// 取得股票歷史資料清單
        /// </summary>
        /// <param name="queryString">搜尋語法，用Where...order by ...</param>
        /// <returns>股票歷史資料清單</returns>
        IList<StockDataVO> GetStockDataList(string queryString);

        /// <summary>
        /// 取得股票歷史資料清單
        /// </summary>
        /// <param name="stockCode">股票代碼</param>
        /// <param name="period">資料週期類型</param>
        /// <param name="startDate">起始時間</param>
        /// <param name="endDate">結束時間</param>
        /// <param name="pageIndex">分頁索引</param>
        /// <param name="pageSize">分頁大小</param>
        /// <param name="sortField">排序欄位</param>
        /// <param name="sortDesc">升降冪排序</param>
        /// <returns>股票歷史資料清單</returns>
        IList<StockDataVO> GetStockDataList(string stockCode, StockDataVO.StockDataPeriod period, DateTime? startDate, DateTime? endDate
            , int pageIndex, int pageSize, string sortField, bool sortDesc);

        /// <summary>
        /// 取得股票歷史資料清單
        /// </summary>
        /// <param name="stockCode">股票代碼</param>
        /// <param name="period">資料週期類型</param>
        /// <param name="startDate">起始時間</param>
        /// <param name="endDate">結束時間</param>
        /// <param name="sortField">排序欄位</param>
        /// <param name="sortDesc">升降冪排序</param>
        /// <returns>股票歷史資料清單</returns>
        IList<StockDataVO> GetStockDataList(string stockCode,StockDataVO.StockDataPeriod period, DateTime? startDate, DateTime? endDate
            , string sortField, bool sortDesc);

        /// <summary>
        /// 取得股票歷史資料筆數
        /// </summary>
        /// <param name="stockCode">股票代碼</param>
        /// <param name="period">資料週期類型</param>
        /// <param name="startDate">起始時間</param>
        /// <param name="endDate">結束時間</param>
        /// <returns>股票歷史資料筆數</returns>
        int CountStockData(string stockCode, StockDataVO.StockDataPeriod period, DateTime? startDate, DateTime? endDate);
    }
}
